import { getData, postData } from '@/utils/request';
import type { LoginParams } from './type';

/**
 * 密码登录
 * @param data
 * @returns
 */
export async function passwordLogin(data: LoginParams) {
  const result = await postData(`/backstageLogin/password`, data);
  return result;
}

/**
 * 获取验证码
 * @param data
 * @returns
 */
export async function getCaptcha(data: string) {
  const result = await getData(`/backstageLogin/captcha/${data}`);
  return result;
}

/**
 * 验证码登录
 * @param data
 * @returns
 */
export async function captchaLogin(data: LoginParams) {
  const result = await postData(`/backstageLogin/captcha`, data);
  return result;
}

/**
 * 注销
 * @param data
 * @returns
 */
export async function logout(data: any) {
  const result = await postData(`/logout`, data);
  return result;
}
